package com.ikun.hosscheduling.controller;


import com.baomidou.mybatisplus.annotation.TableField;
import com.ikun.common.entity.RegistrationType;
import com.ikun.common.entity.TimePeriod;
import com.ikun.hosscheduling.service.RegistrationTypeService;
import com.ikun.hosscheduling.service.TimePeriodService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author sun12
 */
@RestController
public class TypeAndTimeController {


    @Resource
    private TimePeriodService timeService;

    @Resource
    private RegistrationTypeService typeService;

    /**
     * 根据id查询时间段
     */
    @GetMapping("/time/{id}")
    public ResponseEntity<TimePeriod> findTimeById(@PathVariable Integer id) {
        TimePeriod timePeriod = timeService.getById(id);
        return ResponseEntity.ok(timePeriod);
    }

    /**
     * 根据id查询挂号类型
     */
    @GetMapping("/type/{id}")
    public ResponseEntity<RegistrationType> findTypeById(@PathVariable Integer id) {
        RegistrationType registrationType = typeService.getById(id);
        return ResponseEntity.ok(registrationType);
    }


}
